package com.study_security.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.study_security.dto.ProjectDTO;
import com.study_security.dto.ProjectFormDTO;
import com.study_security.entity.Project;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface ProjectMapper extends BaseMapper<Project> {

    List<Project> selectAllProject();
    List<ProjectFormDTO> selectAllProjectFormDTOByUserId(@Param("userId") Long userId);
    List<ProjectFormDTO> selectAllProjectFormDTO();
    List<Project> selectOngoingProjects(@Param("userId") Long userId);

    List<Project> selectCompletedProjects(@Param("userId") Long userId);

    List<Project> searchOngoingProjects(@Param("userId") Long userId, @Param("keyword") String keyword);

    List<Project> searchCompletedProjects(@Param("userId") Long userId, @Param("keyword") String keyword);

    int insert(Project project);

    int countByProjectName(@Param("projectName") String projectName);

    List<ProjectDTO> selectUserProjects(@Param("userId") Long userId);

    Project selectProjectById(@Param("projectId") Long projectId);

    List<Project> findPendingByName(@Param("name") String name);

    List<Project> findApprovedByName(@Param("name") String name);
    List<Project> findOngoingdByName(@Param("name") String name);

    List<Project> findPending();

    List<Project> findApproved();

    List<Project> findOngoing();


    int updateProjectStatus(@Param("projectId") Long projectId, @Param("status") String status);

    List<Project> getAllProject();

    List<Project> selectAllProjectByUserId(Long userId);
}
